#!/usr/bin/python
### author: huseyin
### todo: check http sessions and login cred. in parallel thread (done in same thread.)
### todo: get gateway inputs on runtime: done
### todo: write/read cli completer db to pickle: done
### todo: handle std ctrl+c exceptions : done
### todo: finish cli db : later
### todo: document stuff
### todo: sleep early :)

import includes.db as db
import includes.http as http
import includes.asp_wrapper as wrapper
import includes.completer as autocomp


global debug

debug=0

def init():
	db.init(debug)
	http.init(debug)
	gateway = 'http://' + raw_input("Gateway address: ")
	http.login(gateway)
	wrapper.init(debug,gateway)
	autocomp.init(debug,wrapper.get_managers())

def main():
	init()
	while 1:
		try:	
			command=raw_input("cli # ")
		except (KeyboardInterrupt) :
			pass
			command=""
		autocomp.execute(command)

if __name__ == '__main__':
        main()


